package com.xianzhiOA.interceptor;

import com.xianzhiOA.bean.XzEmp;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Administrator on 2017/4/21.
 */
public class InterForeEnd extends HandlerInterceptorAdapter {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        XzEmp empOnline = (XzEmp) request.getSession().getAttribute("userForeEnd");
        String rPath = request.getServletContext().getContextPath()+"/view/foreEnd/login.html?relogin=go";
        //System.out.println(empOnline+"==="+rPath);
        if(empOnline==null){
            response.sendRedirect(rPath);
            return  false;
        }else{
            return true;
        }
    }
}
